Explicit cast from void* to corresponding type#4
Conversation
Fix compilation without -fpermissive
|
In C, void* should be promoted to any pointer type without problem. Do you really compile this code with C++ compiler? |
At certain compilation flags, even C compiler can start giving warning for the implicit pointer casts, which becomes a real problem with |
|
Please provide a copy of a C (not C++) compiler warning for this case. For my own code I always include the warning or error message reported by the compiler in the commit message. So that it is clear what problem is solved when reviewing the PR or the commit 10 years later. |
ca647f5 to
d3af10b
Compare
|
My first thought was about There is @iakov why do you need have the ability to compile this source using C++ compiler? |
Qbicz
left a comment
There was a problem hiding this comment.
Can you provide the warning text that is being fixed in commit message?
|
Well, yes, my fault. We use C++ as a main language for https://github.com/trikset/trik-studio , and |
Youw
left a comment
There was a problem hiding this comment.
I'm not get use to follow C best practices, so I wouldn't make a last call on this.
But I don't consider including .c/.cpp files in other .c/.cpp files as a good practice unless absolutely necessary.
Although, I don't see anything strictly wrong with this changes.
Co-Authored-By: Ihor Dutchak <ihor.youw@gmail.com>
I prefer explicit INVALID rather than possible compiler warning about uninitialized var sometimes later
Co-Authored-By: Filip Kubicz <Qbicz@users.noreply.github.com>
Fix compilation without -fpermissive
Originally was PR signal11/hidapi#430